// 加载fs模块
let fs = require('fs');
// console.log(fs)
// 加载persons文件
let p = fs.readFileSync(__dirname + "/persons.json","utf8");
// console.log(p);
// 将Json字符串格式转换为对象格式
p = JSON.parse(p);
// console.log(p);
// 现有的数据
let user = { username:"admin1",password:"12345" };

let usermsg = p.find(item => {
    return user.username == item.username && user.password == item.password
});

if(usermsg){
    console.log("登录成功");
} else {
    console.log("登录失败");
} 
